import mineRoutes from "./mineRoutes";

const routes: any = [
  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/resource",
    children: [
      {
        path: "resource", //资源
        name: "Resource",
        component: () => import("@/views/Resource/index.vue"),
        redirect: "/resource/recommend",
        children: [
          {
            path: "recommend",
            name: "Recommend",
            component: () => import("@/views/Resource/Recommend/index.vue"),
          },
          {
            path: "production",
            name: "Production",
            component: () => import("@/views/Resource/Production/index.vue"),
          },
          {
            path: "teach",
            name: "Teach",
            component: () => import("@/views/Resource/Teach/index.vue"),
          },
          {
            path: "topic",
            name: "Topic",
            component: () => import("@/views/Resource/Topic/index.vue"),
          },
          {
            path: "active",
            name: "Active",
            component: () => import("@/views/Resource/Active/index.vue"),
          },
          {
            path: "/resource/watch",
            name: "Watch",
            component: () => import("@/views/Resource/Watch/index.vue"),
          },
          {
            path: "/resource/:id",
            name: "Recommend",
            component: () => import("@/views/Resource/Recommend/index.vue"),
          },
        ],
      },

      {
        path: "class", //课程
        name: "Class",
        component: () => import("@/views/Class/index.vue"),
        redirect: "/class/vip",
        children: [
          {
            path: "vip",
            name: "Vip",
            component: () => import("@/views/Class/Vip/index.vue"),
          },
          {
            path: "videoClass",
            name: "VideoClass",
            component: () => import("@/views/Class/VideoClass/index.vue"),
          },
          {
            path: "live",
            name: "Live",
            component: () => import("@/views/Class/Live/index.vue"),
          },
          {
            path: "offLive",
            name: "OffLive",
            component: () => import("@/views/Class/OffLive/index.vue"),
          },
          {
            path: "subject",
            name: "Subject",
            component: () => import("@/views/Class/Subject/index.vue"),
          },
          {
            path: "special",
            name: "Special",
            component: () => import("@/views/Class/Special/index.vue"),
          },
        ],
      },
      {
        path: "practice", //练习
        name: "Practice",
        component: () => import("@/views/Practice/index.vue"),
      },
      {
        path: "center", //练习同级的中心
        name: "Center",
        component: () => import("@/views/Center/index.vue"),
        children: [
          {
            path: "collections",
            name: "Collections",
            component: () => import("@/views/Center/Collections/index.vue"),
          },
          {
            path: "mediaCache",
            name: "MediaCache",
            component: () => import("@/views/Center/MediaCache/index.vue"),
          },
          {
            path: "view_records",
            name: "View_records",
            component: () => import("@/views/Center/View_records/index.vue"),
          },
        ],
      },
      {
        path: "exchange", //交流
        name: "Exchange",
        component: () => import("@/views/Exchange/index.vue"),
        redirect: "/exchange/systemNote",
        children: [
          {
            path: "interactNote",
            name: "InteractNote",
            component: () => import("@/views/Exchange/InteractNote/index.vue"),
          },
          {
            path: "orderNote",
            name: "OrderNote",
            component: () => import("@/views/Exchange/OrderNote/index.vue"),
          },
          {
            path: "systemNote",
            name: "SystemNote",
            component: () => import("@/views/Exchange/SystemNote/index.vue"),
          },
        ],
      },
      {
        path: "mine", //我的
        name: "Mine",
        component: () => import("@/views/Mine/index.vue"),
        children: mineRoutes,
      },
      {
        path: "detail", //详情页
        name: "Detail",
        component: () => import("@/views/Detail/index.vue"),
        children: [
          {
            path: "video",
            name: "Video",
            component: () => import("@/views/Detail/Video/index.vue"),
          },
          {
            path: "training", //练习详情页
            name: "Training",
            component: () => import("@/views/Detail/Training/index.vue"),
          },
        ],
      },
      {
        path: "/404",
        name: "404",
        component: () => import("@/views/404/404.vue"),
      },
      /* 匹配任意的路由 必须最后注册 */
      {
        path: "/:pathMatch(.*)",
        name: "Any",
        redirect: "/404",
      },
    ],
  },
];

export default routes;
